﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LTJ.Common;
using LTJ.Entity;
using LTJ.Data;
using LTJ.FrameWork;
using System.Data;

namespace uswinweb.datacontrol
{
    public partial class pop_purposePortList : System.Web.UI.UserControl
    {
        public DataTable qygTab = new DataTable();
        public string strWhere = " 1=1 ";
        public int pagesize = 10;
        public int pageindex = SASRequest.GetInt("currentPage", 1);
        public string action = SASRequest.GetString("action");
        public string parpms = LTJ.Common.Utils.UrlDecode(SASRequest.GetString("parms").Trim());
        public string searchtype = SASRequest.GetString("seatype").Trim();
        public string tcode = LTJ.Common.Utils.UrlDecode(SASRequest.GetString("tcode").Trim());
        public string name = LTJ.Common.Utils.UrlDecode(SASRequest.GetString("name").Trim());
        public string ename = LTJ.Common.Utils.UrlDecode(SASRequest.GetString("ename").Trim());
        public string pageList = "";
        public string orderstr = " order by id asc ";
        public string bcode = "ports";
        public pop_purposePortList()
        {
            int recordcount = 0;

            if (bcode != "")
            {
                strWhere += " and code='" + bcode+"'";
            }
            recordcount = BaseDatas.GetBaseDataCount(strWhere);
            qygTab = BaseDatas.GetBaseDataByPage(pageindex, pagesize, strWhere, orderstr);
            pageList = GetPageList(recordcount, pagesize, pageindex);
        }
        public string GetPageList(int recordcount, int pagesize, int currentpage)
        {
            if (SASRequest.GetInt("postnumber", 0) > 0)
            {
                return LTJ.Common.Utils.LuffyPage3(recordcount, pagesize, currentpage, "pop_purposePortList.ascx", "postnumber=" + SASRequest.GetInt("postnumber", 0), "showdata2");
            }
            else
            {
                return LTJ.Common.Utils.LuffyPage3(recordcount, pagesize, currentpage, "pop_purposePortList.ascx", "action=" + action + "&parms=" + parpms + "&tcode=" + tcode + "&name=" + name + "&ename=" + ename + "", "showdata2");
            }
        }
        public string GetName(string pcode, string type)
        {
            string msg = "&nbsp;";
            string strWhere = " code='" + type.Trim() + "' and tcode='" + pcode.Trim() + "' ";
            BaseDataInfo binfo = BaseDatas.GetBaseDataByStr(strWhere);
            if (binfo != null)
            {
                msg = binfo.name;
            }
            return msg;
        }
    }
}